package com.zjj.springstu.springHandwriting.app.service;

import com.zjj.springstu.springHandwriting.framework.annotation.Component;
import com.zjj.springstu.springHandwriting.framework.context.ZjjAnnotationApplicationContext;
import com.zjj.springstu.springHandwriting.framework.intf.ApplicationContextAware;
import com.zjj.springstu.springHandwriting.framework.intf.InitializingBean;

@Component(beanName = "userService1")
public class UserService implements InitializingBean, ApplicationContextAware {
	private ZjjAnnotationApplicationContext applicationContext;

	private Integer age;

	public void sayHi() {
		System.out.println("Hi! 子坚君");
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Override
	public void afterPropertiesSet() {
		System.out.println("我是UserService，我正在初始化");
		System.out.println("applicationContext是：" + applicationContext);
	}

	@Override
	public void setApplicationContext(ZjjAnnotationApplicationContext applicationContext) {
		this.applicationContext = applicationContext;
	}
}
